package com.chouxiaozi.openfeigndemo.consume;

import com.chouxiaozi.openfeigndemo.feignclient.FeignApiInteferce;
import com.chouxiaozi.openfeigndemo.vo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

/**
 * 消费者，通过open-feign去调用produce接口
 * @Author ws
 * @create 2023/4/21 16:58
 */
@RestController
@RequestMapping("/consume")
public class ConsumeController {
    @Autowired
    private FeignApiInteferce feignApiInteferce;

    @GetMapping("/post1")
    public String post1(){
        User user = new User("臭小子","男");
        return feignApiInteferce.post1(user);
    }

    @GetMapping("/post2")
    public String post2(){
        User user = new User("臭小子","男");
        return feignApiInteferce.post2("testAuth", user);
    }

    @GetMapping("/post3")
    public String post3(){
        User user = new User("臭小子","男");
        return feignApiInteferce.post3("testAuth", "testgg", user);
    }

    @GetMapping("/post4")
    public String post4(){
        User user = new User("臭小子","男");
        return feignApiInteferce.post4("testAuth", "1", "testgg", user);
    }

    @GetMapping("/post5")
    public String post5(){
        LinkedMultiValueMap<String, Object> multiValueMap = new LinkedMultiValueMap<>();
        multiValueMap.add("name","臭小子");
        multiValueMap.add("sex", "男");
        return feignApiInteferce.post5(multiValueMap);
    }

    @GetMapping("/post6")
    public String post6(){
        User user = new User("臭小子","男");
        return feignApiInteferce.post6(user);
    }

    @GetMapping("/post7")
    public String post7(){
        return feignApiInteferce.post7("臭小子", "男");
    }

    @GetMapping("/post8")
    public String post8(){
        return feignApiInteferce.post8("臭小子", "男");
    }

    @GetMapping("/post9")
    public String post9(){
        User user = new User("臭小子","男");
        return feignApiInteferce.post9(user);
    }
}
